package com.geekaca.jsp;

import com.geekaca.jsp.pojo.BrandType;
import com.geekaca.jsp.service.TypeService;

import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import java.util.List;

@WebServlet(urlPatterns = "/start",loadOnStartup = 1)
public class StartServlet extends HttpServlet {

    private TypeService typeService = new TypeService();

    @Override
    public void init(ServletConfig config) throws ServletException {
        List<BrandType> typeList = typeService.selectAll();

        ServletContext servletContext = config.getServletContext();
        servletContext.setAttribute("companyName", "Geekaca");
        servletContext.setAttribute("allType", typeList);
        System.out.println("startServlet.........");
    }

}
